<DOCTYPE html>
  <html lang="en">

  <head charset="UTF-8">
    <title></title>
  </head>

  <body>
    <script>
      function ArrayList() {
        let array = [];

        ArrayList.prototype.insert = key => {
          this.array.push(key);
        }

        ArrayList.prototype.toString = () => {
          return this.array.join(',')
        }

        ArrayList.prototype.swap = (numOne, numTwo) => {
          let temp = this.array[numOne];
          this.array[numOne] = this.array[numTwo];
          this.array[numTwo] = temp
        }

        ArrayList.prototype.median = (left, right) => {
          let center = Math.floor((left + right) / 2);
          if (this.array[left] > this.array[center]) {
            this.swap(left, center);
          }
          if (this.array[center] > this.array[right]) {
            this.swap(center, right);
          }
          return center
        }

        ArrayList.prototype.quickSort = (left, right) => {
          if (left >= right) return
          let center = this.median(left, right);
          this.swap(center, right - 1);
          let m = left;
          let n = right;
          while (m < n) {
            while (this.array[m++] > this.array[center]) { };
            while (this.array[n--] < this.array[center]) { }
            this.swap(m, n);
          }
          this.swap(center, n);
          this.quickSort(left, center - 1);
          this.quickSort(center + 1, right);
        }
      }

      function prime(num) {
        for (i = 2; i < Math.floor(Math.sqrt(num)); i++) {
          if (num % i == 0) {
            return false
          }
        }
        return true
      }

      console.log(prime(7));
    </script>
  </body>

  </html>